#include <stdio.h>
#include <unistd.h>
#include <linux/input.h>
#include <fcntl.h>


int main(void)
{
	int ret;
	struct input_event event;
	int fd=open("/dev/event1", O_RDWR);

	if(fd < 0)
	{
		printf("open failed\n");
		return 0;
	}

	while(1)
	{
		ret = read(fd, &event, sizeof(event));
		if (ret == sizeof(event))
		{
			printf("code:%d,val%d\n", event.code, event.value);
		}
		else
		{
			printf("read error\n");
		}
	}	

	close(fd);

	return 0;
}
